home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / web / noweb / src / c / strsave.nw < prev   
Text File  |  1995-02-24  |  409b  |  18 lines

  1. % Copyright 1991 by Norman Ramsey.  All rights reserved.
  2. % See file COPYRIGHT for more information.
  3. <<header>>=
  4. char *strsave (char *s);        /* returns a pointer to a fresh copy of s */
  5. <<*>>=
  6. #include <stdio.h>
  7. #include <string.h>
  8. #include <stdlib.h>
  9. #include "strsave.h"
  10. #include "errors.h"
  11.  
  12. char *strsave (char *s) {
  13.     char *t = malloc (strlen(s)+1);
  14.     checkptr(t);
  15.     strcpy(t,s);
  16.     return t;
  17. }
  18.